package com.zeldu.video.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zeldu.video.pojo.Video;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface VideoMapper extends BaseMapper<Video> {

    @Select("select * from video")
    List<Video> queryAll();

    @Select("SELECT * FROM video WHERE course_id=#{course_id} AND id!=#{id} AND TYPE=0 ORDER BY createTime")
    List<Video> queryRecorded(@Param("course_id") Long course_id,@Param("id") Long id);

    @Select("SELECT * FROM video WHERE course_id=#{course_id} AND TYPE=0 ORDER BY createTime")
    List<Video> queryRecordedNew(@Param("course_id") Long course_id);

    @Select("SELECT * FROM video WHERE course_id=#{course_id} AND TYPE=1 ")
    List<Video> queryLive(@Param("course_id") Long course_id);

    @Select("select * from video where id=#{id}")
    List<Video> queryOnce(@Param("id") Long id);

    @Delete("delete  from video where id=#{id}")
    void delVideo(@Param("id") Long id);

}
